<script type="text/javascript">//<![CDATA[
	XHR.poll(11, '<%=luci.dispatcher.build_url("admin", "services", "adbrun", "status")%>', null,
		function(x, st)
		{
			var tb = document.getElementById('adbrun_status_table');
			if (st && tb)
			{
				while(tb.rows.length > 1)
					tb.deleteRow(1);
				for( var i = 0; i < st.length; i++ )
				{
					var tr = tb.insertRow(-1);
					tr.className = 'cbi-section-table-row' ;

					tr.insertCell(-1).innerHTML = (function(){ 
									var num = st[i].num;
									if(num <= 9){
										return "0" + num;
									}else{
										return num;
									}})();
					tr.insertCell(-1).innerHTML = (function() {
									var devname = st[i].name;
									return String.format('<font color="blueviolet">') + devname + String.format('</font>');
									})();
					tr.insertCell(-1).innerHTML = st[i].deviceid + ":" + st[i].port;
					tr.insertCell(-1).innerHTML = (function(){
									var apkid = st[i].apk;
									if(apkid == "com.ss.android.article.lite"){
										return String.format("今日头条极速版");
									}else if(apkid == "com.ss.android.article.news"){
										return String.format('今日头条');
									}else if(apkid == "com.ss.android.article.video"){
										return String.format('西瓜视频');
									}else if(apkid == "com.ss.android.ugc.aweme"){
										return String.format('抖音');
									}else if(apkid == "com.ss.android.ugc.aweme.lite"){
										return String.format('抖音极速版');
									}else if(apkid == "com.ss.android.ugc.live"){
										return String.format('抖音火山版');
									}else if(apkid == "com.smile.gifmaker"){
										return String.format('快手');
									}else if(apkid == "com.kuaishou.nebula"){
										return String.format('快手极速版');
									}else if(apkid == "com.xs.fm"){
										return String.format('番茄畅听');
									}else if(apkid == "com.baidu.searchbox.lite"){
										return String.format('百度极速版');
									}else if(apkid == "com.ximalaya.ting.android"){
										return String.format('喜马拉雅');
									}else if(apkid == "com.ximalaya.ting.lite"){
										return String.format('喜马拉雅极速版');
									}else if(apkid == "com.dragon.read"){
										return String.format('番茄小说');
									}else if(apkid == "com.tencent.mm"){
										return String.format('微信');
									}else if(apkid == "com.tencent.mobileqq"){
										return String.format('QQ');
									}else if(apkid == "com.tencent.mtt"){
										return String.format('QQ浏览器');
									}else if(apkid == "com.taobao.taobao"){
										return String.format('淘宝');
									}else if(apkid == "com.taobao.litetao"){
										return String.format('淘宝特价版');
									}else if(apkid == "com.taobao.live"){
										return String.format('点淘');
									}else if(apkid == "com.jingdong.app.mall"){
										return String.format('京东');
									}else if(apkid == "com.jd.jdlite"){
										return String.format('京东极速版');
									}else if(apkid == "com.sankuai.meituan"){
										return String.format('美团');
									}else if(apkid == "mobi.w3studio.apps.android.shsmy.phone"){
										return String.format('随申办');
									}else if(apkid == "com.autonavi.minimap"){
										return String.format('高德地图');
									}else if(apkid == "com.baidu.BaiduMap"){
										return String.format('百度地图');
									}else if(apkid == "com.baidu.searchbox"){
										return String.format('百度');
									}else if(apkid == "com.eg.android.AlipayGphone"){
										return String.format('支付宝');
									}else if(apkid == "com.alibaba.android.rimet"){
										return String.format('钉钉');
									}else if(apkid == "com.UCMobile"){
										return String.format('UC浏览器');
									}else if(apkid == "tv.danmaku.bili"){
										return String.format('bilibili');
									}else if(apkid == "com.kugou.android"){
										return String.format('酷狗音乐');
									}else if(apkid == "com.android.camera"){
										return String.format('照相机');
									}else if(apkid == "com.android.camera2"){
										return String.format('相机');
									}else if(apkid == "com.android.browser"){
										return String.format('浏览器');
									}else if(apkid == "org.videolan.vlc"){
										return String.format('VLC播放器');
									}else if(apkid == "com.tencent.qqlive"){
										return String.format('腾讯视频');
									}else if(apkid == "com.qiyi.video"){
										return String.format('爱奇艺');
									}else if(apkid == "com.qiyi.video.lite"){
										return String.format('爱奇艺极速版');
									}else if(apkid == "com.youku.phone"){
										return String.format('优酷视频');
									}else if(apkid == "com.sohu.sohuvideo"){
										return String.format('搜狐视频');
									}else if(apkid == "com.xingin.xhs"){
										return String.format('小红书');
									}else if(apkid == "com.kmxs.reader"){
										return String.format('七猫免费小说');
									}else if(apkid == "air.tv.douyu.android"){
										return String.format('斗鱼');
									}else if(apkid == "com.blizzard.wtcg.hearthstone"){
										return String.format('炉石传说');
									}else if(apkid == "com.tencent.lolm"){
										return String.format('英雄联盟');
									}else if(apkid == "com.xunmeng.pinduoduo"){
										return String.format('拼多多');
									}else if(apkid == "com.android.chrome"){
										return String.format('谷歌浏览器');
									}else if(apkid == "com.tencent.edu"){
										return String.format('腾讯课堂');
									}else if(apkid == "com.sina.weibo"){
										return String.format('新浪微博');
									}else if(apkid == "com.tencent.news"){
										return String.format('腾讯新闻');
									}else if(apkid == "com.sonelli.juicessh"){
										return String.format('JuiceSSH');
									}else if(apkid == "cn.wps.moffice_eng"){
										return String.format('WPS Office');
									}else if(apkid == "com.tencent.android.qqdownloader"){
										return String.format('应用宝');
									}else if(apkid == "com.app.shanghai.metro"){
										return String.format('Metro大都会');
									}else if(apkid == "com.achievo.vipshop"){
										return String.format('唯品会');
									}else if(apkid == "com.tencent.tmgp.sgame"){
										return String.format('王者荣耀');
									}else if(apkid == "com.tencent.tmgp.minitech.miniworld"){
										return String.format('迷你世界');
									}else if(apkid == "com.wepie.snake.new.mi"){
										return String.format('贪吃蛇大作战');
									}else if(apkid == "com.woyou.snakemerge.mi"){
										return String.format('贪吃蛇进化论');
									}else if(apkid == "cn.fzrztechnology.chouduoduo"){
										return String.format('抽多多');
									}else if(apkid == "com.miui.gallery"){
										return String.format('图库');
									}else if(apkid == "com.android.gallery3d"){
										return String.format('图库');
									}else if(apkid == "com.sprd.sprdnote"){
										return String.format('记事本');
									}else if(apkid == "com.android.calculator2"){
										return String.format('计算器');
									}else if(apkid == "com.android.fmradio"){
										return String.format('FM电台');
									}else if(apkid == "com.android.soundrecorder"){
										return String.format('录音机');
									}else if(apkid == "com.android.calendar"){
										return String.format('日历');
									}else if(apkid == "com.android.incallui"){
										return String.format('电话通话');
									}else if(apkid == "init_adbrun"){
										return String.format('初始化设备');
									}else{
										return String.format('<font color="red">') + apkid + String.format('</font>');
									}})();
					tr.insertCell(-1).innerHTML = (function(){
									var kpid = st[i].pid;
									if(kpid == ""){
										return String.format('<font color="red">未计时</font>');
									}else{
										if(st[i].runtime == 0){
											return String.format('<font color="green">读取时间</font>');
										}else{
											return String.format('<font color="green">') + st[i].runhours + "时" + st[i].runmins + "分" + st[i].runsecs + "秒" + String.format('</font>');
									}}})();
					tr.insertCell(-1).innerHTML = (function(){
									var kpid = st[i].pid;
									if(kpid == ""){
										return String.format('<font color="red">未运行</font>');
									}else{
										return String.format('<font color="green">') + kpid + String.format('</font>');
									}})();
					var myDate = new Date();
					tr.insertCell(-1).innerHTML = (function(){
									var kvid = st[i].deviceid
									new XHR().post('<%=luci.dispatcher.build_url("admin", "services", "adbrun", "getscreen")%>', {sctime: myDate.getSeconds(),screenid : kvid},
									function(x,data){});
									return '<button type=\"button\" onclick=\"window.open(\'http:\/\/' + window.location.hostname + ":" + st[i].uhttpd + '/' + kvid + '\.png \')\">预览</button>';
									})();
				}
			}
		}
	);
//]]></script>

<fieldset class="cbi-section">
<div><%:激活的ADB设备列表%>
	<table class="cbi-section-table" id="adbrun_status_table" border="2">
		<tr class="cbi-section-table-titles">
			<th class="cbi-section-table-cell"><%:序号%></th>
			<th class="cbi-section-table-cell"><%:设备名%></th>
			<th class="cbi-section-table-cell"><%:设备ID%></th>
			<th class="cbi-section-table-cell"><%:当前程序%></th>
			<th class="cbi-section-table-cell"><%:脚本运行时长%></th>
			<th class="cbi-section-table-cell"><%:脚本pid%></th>
			<th class="cbi-section-table-cell"><%:预览%></th>
		</tr>
		<tr class="cbi-section-table-row">
			<td colspan="7"><em><br /><%:Collecting data...%></em></td>
		<tr>
	</table>
</div>
</fieldset>
